import request from '@/utils/request'

// 查询CRM线索列表
export function listClue(query, rowtype) {
  query.type = rowtype;
  console.info(query);
  return request({
    url: '/crm/clue/list',
    method: 'get',
    params: query
  })
}

// 查询CRM线索详细
export function getClue(id) {
  return request({
    url: '/crm/clue/' + id,
    method: 'get'
  })
}

// 新增CRM线索
export function addClue(data) {
  return request({
    url: '/crm/clue',
    method: 'post',
    data: data
  })
}

// 修改CRM线索
export function updateClue(data) {
  return request({
    url: '/crm/clue',
    method: 'put',
    data: data
  })
}

// 填写跟进记录
export function followRecords(data) {
  console.info(data);
  return request({
    url: '/crm/clueFollrecords/addRecord',
    method: 'post',
    data: data
  })
}

// 删除CRM线索
export function delClue(id) {
  return request({
    url: '/crm/clue/' + id,
    method: 'delete'
  })
}

// 转移线索至客户
export function transferClueToCustomer(data) {
  console.info(data);
  return request({
    url: '/crm/clue/transferClueToCustomer',
    method: 'post',
    data: data
  })
}

// 转移线索至线索池
export function transferClueToCluePool(data) {
  console.info(data);
  return request({
    url: '/crm/clue/transferClueToCluePool',
    method: 'post',
    data: data
  })
}

export function getListElectricAalesFlowList(query) {
  console.info(1);
  return request({
    url: '/crm/clueFollrecords/list',
    method: 'get',
    params: query
  })
}

export function getListByContract(query) {
  console.info(2);
  return request({
    url: '/crm/company/list',
    method: 'get',
    params: query
  })
}

export function getListOperateLogList(query) {
  console.info(3);
  return request({
    url: '/crm/clueFollrecords/list',
    method: 'get',
    params: query
  })
}

export function getClueBaseInfo(id) {
  console.info(4);
  return request({
    url: '/crm/clue/' + id,
    method: 'get'
  })
}

export function getManage(esId) {
  console.info(esId);
  return request({
    url: '/crm/company/getInfos/' + esId,
    method: 'get'
  })
}
